import { getCategoryAPI } from '@/apis/category';
import { ref, onMounted, onBeforeUpdate } from 'vue';
import { useRoute } from 'vue-router';


export function useCategory(){
  const categoryData = ref({});
const getCategoryData = async()=>{
  const route = useRoute();
  const res = await getCategoryAPI(route.params.id)
  categoryData.value = res.result;
}
onBeforeUpdate(()=>{
  getCategoryData()
})
onMounted(()=>{
  getCategoryData()
})
return{
  categoryData
}
}
